qrisp.QuantumFloat.get_ev#

QuantumFloat.get_ev(**mes_kwargs)[source]#

Retrieves the expectation value of self.

Parameters:
**mes_kwargsdict

Keyword arguments for the measurement. See qrisp.QuantumVariable.get_measurement() for more information.

Returns:
float

The expectation value.

Examples

We set up a QuantumFloat in uniform superposition and retrieve the expectation value:

>>> from qrisp import QuantumFloat, h
>>> qf = QuantumFloat(4)
>>> h(qf)
>>> qf.get_ev()
7.5